$(document).ready(function(){
var ta=$("#listDivHidden").val();//1==hidden 2==display
var ni;
$("a.expand").click(function(){
		$("a.expand").removeClass("folded");
		$(".chambar").hide();
		if(ni==undefined)
		{	
			ni=$(this).attr("id");
		}
		if(ni== $(this).attr("id")){
		if(ta=='1'){
			$(this).addClass("folded");
			$("."+ $(this).attr("id")).show();
			ni= $(this).attr("id");
			ta='2';
		}else{
			ta='1';
		}}
		else{
			$(this).addClass("folded");
			$("."+ $(this).attr("id")).show();
			ni= $(this).attr("id");
			ta='2';
		}
	});
/*$(".cofo").click(function(){
		$(".chambar").hide();
		$("a.expand").removeClass("folded");
	});*/


$(".selects li:first").addClass("current");
$(".selects li").mouseover(function(){
		$(".selects li").removeClass("current");
		$(this).addClass("current");
	});
$(".selects li").click(function(){
		$(".selects").hide();
	});

$(".picnav li").click(function(){
		$(".picnav li").removeClass("current");
		$(this).addClass("current");
	});

$(".taghot li:first").addClass("current");
	$(".taghot li").click(function(){
		$(".taghot li").removeClass("current");
		$(this).addClass("current");
		$(".checklist").hide();
		$("."+ $(this).attr("id")).show();
	});
});

$(".colseche").click(function(){
		var tempObject=document.getElementsByName("business");
		var tempSize=tempObject.length;
		
		for (i=0; i<tempSize; i++)
    	{
        if (tempObject[i].checked == true) {
        	document.getElementById("businessId"+i).checked=false;
        	
        }
   		}
   		
   		var tempObject_info=document.getElementsByName("businessinfo");
		var tempSize_info=tempObject_info.length;
		
		for (i=0; i<tempSize_info; i++)
    	{
        	document.getElementById("businessinfo"+i).checked=false;
        	document.getElementById("businessinfo"+i).disabled=false;
        }
   		
   		var tempObject_zone=document.getElementsByName("zoneinfo");
		var tempSize_zone=tempObject_zone.length;
		
		for (i=0; i<tempSize_zone; i++)
    	{
        	document.getElementById("zoneinfo"+i).checked=false;
        	document.getElementById("zoneinfo"+i).disabled=false;
        }
   		
		$(".filtermore").hide();
	});
$(".chemore").click(function(){
		var tempObject=document.getElementsByName("business");
		var tempSize=tempObject.length;
		var chestr="";
		for (i=0; i<tempSize; i++)
    	{
        if (tempObject[i].checked == true) {
        	document.getElementById("businessinfo"+i).checked=true;
        	chestr+=tempObject[i].value+","; 
        }else{
       	 document.getElementById("businessinfo"+i).checked=false;
        }
   		}
		document.getElementById("businessvalue").value=chestr;	
		$(".filtermore").show();
	});
$(".chemore1").click(function(){	
		var tempCount=0;
		var tempObject=document.getElementsByName("businessinfo");
		var tempObject_update=document.getElementsByName("businessUpdate");
		var tempSize=tempObject.length;
		var tempSize_update=tempObject_update.length;
		var chestr="";
		for (i=0; i<tempSize; i++)
    	{
    		for(j=0;j<tempSize_update;j++){
    			if (tempObject[i].value == tempObject_update[j].value) {
        			document.getElementById("businessinfo"+i).checked=true;
        			chestr+=tempObject[i].value+","; 
        			 tempCount = tempCount+1;
        		}
        	}	
        }	
       	if(tempCount>2){
   			for(i=0;i<tempSize;i++){
   			if(tempObject[i].checked!=true){
   			tempObject[i].disabled=true;
   			}
   			}
        }else{
        	for(i=0;i<tempSize;i++){
   			tempObject[i].disabled=false;
   			}
        }
   		
		document.getElementById("businessvalue").value=chestr;	
		$(".filtermore").show();
	});
	
$(".chemore2").click(function(){	
		var tempCount=0;
		var tempObject=document.getElementsByName("zoneinfo");
		var tempObject_update=document.getElementsByName("zoneUpdate");
		var tempSize=tempObject.length;
		var tempSize_update=tempObject_update.length;
		var chestr="";
		for (i=0; i<tempSize; i++)
    	{
    		for(j=0;j<tempSize_update;j++){
    			if (tempObject[i].value == tempObject_update[j].value) {
        			document.getElementById("zoneinfo"+i).checked=true;
        			chestr+=tempObject[i].value+","; 
        			 tempCount = tempCount+1;
        		}
        	}	
        }	
       	if(tempCount>2){
   			for(i=0;i<tempSize;i++){
   			if(tempObject[i].checked!=true){
   			tempObject[i].disabled=true;
   			}
   			}
        }else{
        	for(i=0;i<tempSize;i++){
   			tempObject[i].disabled=false;
   			}
        }
   		
		document.getElementById("zoneinfo").value=chestr;	
		$(".filtermore").show();
	});
	
$(".wid input").click(function(){
		$(".filtermore").show();
	});

$(".shm").click(function(){
		var tempObject=document.getElementsByName("othervalue_value");
		var tempSize=tempObject.length;
		
		for (i=0; i<tempSize; i++)
    	{
        if (tempObject[i].checked == true) {
        	document.getElementById("otherinfoId"+i).checked=false;
        	
        }
   		}

		$(".sslist").hide();
	});

$(".sSi input").click(function(){
		$(".sslist").show();
	});


$(function(){
$(".arrde").hover( 
	function () { 
		$(this).addClass("arred");
	}, 
	function () { 
		$(this).removeClass("arred");
	}
)
}) 
//=====================
$(function(){
$(".adnpdiv").hover( 
	function () { 
		$(this).addClass("adimgshow");
	}, 
	function () { 
		$(this).removeClass("adimgshow");
	}
)
}) 
//==================

var t = n = 0, count = $(".ad-image-wrapper img").size();
$(function(){
	$(".ad-image-wrapper img:not(:first-child)").hide();
	$(".adtit").html($(".ad-image-wrapper img:first-child").find("img").attr('alt'));
	$(".adnext li:first-child").addClass("current");
	//$(".adtit").click(function(){window.open($(".ad-image-wrapper img:first-child").attr('href'), "_blank")});
	$(".adnext li").click(function() {
		var i = $(this).text() - 1;
		n = i;
		if (i >= count) return;
		$(".adtit").html($(".ad-image-wrapper img").eq(i).find("img").attr('alt'));
		//$(".adtit").unbind().click(function(){window.open($(".ad-image-wrapper img").eq(i).attr('href'), "_blank")})
		$(".ad-image-wrapper img").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);
		$(this).removeClass("current").siblings().addClass("current");
	});
	t = setInterval("showAuto()", 2000);
	$(".picshow").hover(function(){clearInterval(t)}, function(){t = setInterval("showAuto()", 2000);});
	$(".ad-prev").click(function() {
	--n;
	if (n<0) {
	n=count-1;
	}
	$(".adnext li").eq(n).trigger('click');
	});
	$(".ad-next").click(function() {
	++n;
	if (n >count-1) {
	n=0;
	}
	$(".adnext li").eq(n).trigger('click');
	});

})

function showAuto()
{
	n = n >= (count - 1) ? 0 : ++n;
	$(".adnext li").eq(n).trigger('click');
}